package com.example.myviewmodelframe.model

import android.os.Handler
import android.os.Looper
import android.os.Parcel
import android.os.Parcelable
import androidx.lifecycle.MutableLiveData
import com.example.myviewmodelframe.base.model.BaseViewModel
import com.example.myviewmodelframe.model.bean.BaseBean
import com.example.myviewmodelframe.model.bean.UserInfoBea
import com.example.myviewmodelframe.model.bean.UserInfoBea2

/**
 * @author tgw
 * @date 2021/6/11
 * @describe
 */
class MainActivityViewModel2 : IGetViewModel<UserInfoBea2>() {
    private var userInfo: UserInfoBea2 = UserInfoBea2()

//    private fun getLiveData(): UserInfoBea2 {
//        return UserInfoBea2().also { userInfo = it }
//    }

    fun createButtonText() {
        userInfo.apply {
            name = "tgw按钮第二层model"
            age = 235
        }
        var h = Handler(Looper.myLooper()!!)
        h.postDelayed(Runnable {
            model?.value = userInfo
        }, 5000)
    }
}